package com.wispx.gateway.core.util;

import io.netty.channel.epoll.Epoll;

public class OSUtil {

    private static String OS_NAME = System.getProperty("os.name").toLowerCase();
    private static boolean isLinux = false;
    private static boolean isWindows = false;
    private static boolean isMac = false;

    static {
        if (OS_NAME.contains("linux")) {
            isLinux = true;
        }
        if (OS_NAME.contains("windows")) {
            isWindows = true;
        }
        if (OS_NAME.contains("mac")) {
            isMac = true;
        }
    }

    private OSUtil(){

    }

    public static boolean isLinux(){
        return isLinux;
    }

    public static boolean isWindows(){
        return isWindows;
    }

    public static boolean isMac(){
        return isMac;
    }

    public static boolean supportEpoll(){
        return isLinux && Epoll.isAvailable();
    }

}
